package cn.domypay.back.main;

import cn.domypay.back.conf.SysContants;
import cn.domypay.back.exception.DoMyPayException;
import cn.domypay.back.factory.Factory;
import cn.domypay.back.log.DoMyPayLogger;
import cn.domypay.back.utils.ReadProperties;

/**
 * 订单交易引擎主处理类
 * 
 * @author lifan sun
 *
 */
public class DoMyPayEngineMain {
	
	private final static DoMyPayLogger logger = DoMyPayLogger.getLogger(DoMyPayLogger.class);
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自动生成方法存根
		while(true)
		{
			OrderMain orderMain = (OrderMain)Factory.getInstantBiz("orderMain");
			try {
				Thread.sleep(Long.valueOf(ReadProperties.init(SysContants.DEFAULT_PROPERTIES_FILE).getProperty("time.sleep")));
				orderMain.runDealOrder();
			} catch (NumberFormatException e) {
				// TODO 自动生成 catch 块
				logger.logError(e.getMessage());
			} catch (DoMyPayException e) {
				// TODO 自动生成 catch 块
				logger.logError(e.getMessage());
			} catch (InterruptedException e) {
				// TODO 自动生成 catch 块
				logger.logError(e.getMessage());
			}
		}
		
	}
	

}
